from utils.text_utils import TextUtils
from db.mysql import MySqlDba
from bidspider.items import BidspiderItem
from datetime import datetime


def text_utils_test():
    content = """
        <body lang=ZH-CN style='tab-interval:21.0pt;word-wrap:break-word;text-justify-trim:punctuation'>
        <img class="item-target" src="https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64" alt="">
        <div class=WordSection1 style='layout-grid:15.6pt'>
        <p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>一、采购人：宜兴经济技术开发区管理委员会<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>联系人：史进<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>联系方式：<spanlang=EN-US>0510-87660315</span><span lang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>联系地址：宜兴市经济开发区<spanclass=GramE>屺</span>亭街道文庄路<span lang=EN-US>16</span>号<span lang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>二、采购项目名称：宜兴经济技术开发区一般工业污水厂特许经营项目<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left;text-indent:28.0pt;mso-char-indent-count:2.0;line-height:30.0pt;mso-line-height-rule:exactly;mso-pagination:widow-orphan;mso-layout-grid-align:none'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>现将该项目的招标内容予以公示，征求各潜在供应商意见。请潜在供应商将修改意见以书面形式加盖公章、法人或授权代表签字，注明联系人、联系方式，提交至采购人。招标内容电子文档及市场调研表在“江苏政府采购网”（</span><spanlang=EN-US><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333;text-decoration:none;text-underline:none'>http://www.ccgp-jiangsu.gov.cn</span></span><spanstyle='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>）附件中发布。<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>三、公告期限<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>公告开始期限：<spanlang=EN-US>2023</span>年<span lang=EN-US>12</span>月<span lang=EN-US>4</span>日<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>公告结束期限：<spanlang=EN-US>2023</span>年<span lang=EN-US>12</span>月<span lang=EN-US>7</span>日<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>四、意见反馈时限<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>反馈开始时间：<spanlang=EN-US>2023</span>年<span lang=EN-US>12</span>月<span lang=EN-US>4</span>日<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=left style='text-align:left'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>反馈结束时间：<spanlang=EN-US>2023</span>年<span lang=EN-US>12</span>月<span lang=EN-US>7</span>日<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=right style='text-align:right;text-indent:28.0pt;mso-char-indent-count:2.0;line-height:30.0pt;mso-line-height-rule:exactly;mso-pagination:widow-orphan;mso-layout-grid-align:none'><span style='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>宜兴经济技术开发区管理委员会<spanlang=EN-US><o:p></o:p></span></span></p><p class=MsoNormal align=right style='text-align:right;text-indent:28.0pt;mso-char-indent-count:2.0;line-height:30.0pt;mso-line-height-rule:exactly;mso-pagination:widow-orphan;mso-layout-grid-align:none'><span lang=EN-USstyle='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>2023</span><spanstyle='font-size:14.0pt;font-family:宋体;mso-bidi-font-family:Arial;color:#333333'>年<spanlang=EN-US>12</span>月<span lang=EN-US>4</span>日<span lang=EN-US><o:p></o:p></span></span></p></div></body><br><br><font style="font-weight:bold;font-size:14px;">附件：</font><a href="http://www.ccgp-jiangsu.gov.cn/finscms/FinsCms_DATA/202312/1701654143479022089.pdf" ignore=1>采购需求及专家需求论证意见.pdf</a><BR/><a href="http://www.ccgp-jiangsu.gov.cn/finscms/FinsCms_DATA/202312/1701654143548042519.doc" ignore=1>项目市场调研记录1202.doc</a><br>
    """
    print(TextUtils.format_content(content, None))


def test_date_utils():
    # print(TextUtils.data_time_is_available('2023-12-05 11:35', '%Y-%m-%d %H:%M'))
    # print(TextUtils.get_current_datetime_str())
    print(TextUtils.get_uuid())


def test_db():
    # print(MySqlDba.get_instance().save_title("测试"))
    # print(MySqlDba.get_instance().title_exist("测试"))
    # for i in range(10):
    #     item = BidspiderItem()
    #     item['title'] = "测试村上春树" + str(i)
    #     item['ctime'] = datetime.now()
    #     print(MySqlDba.get_instance().save_bid(item))
    # list = MySqlDba.get_instance().get_bid_list()
    # for item in list:
    #     item['title'] = "修改后：" + item['title']
    #     item['content'] = item['title']
    #     print(MySqlDba.get_instance().update_bid(item))
    # item = BidspiderItem()
    # item['id'] = '1701758650'
    # print(MySqlDba.get_instance().delete_bid(item))
    print("正在存储item：%s" % 'dsd')


test_db()
# test_date_utils()
